﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Quanlynhasach.hethongxuly;
using Quanlynhasach.hethongluutru;

namespace Quanlynhasach.hethongluutru
{
    class QuyDinhDAO
    {
        public static DataTable GetQuyDinh()
        {
            string sql = "select * from QuyDinh";
            return database.ExcuQuery(sql);
        }
        static public DataTable SlectSoLuongTon(int masach)
        {
            string sql = "select * from SACH where MaSach=" + masach + "";
            return database.ExcuQuery(sql);
        }
        static public DataTable SlectTienNoKH(int makh)
        {
            string sql = "select * from KHACHHANG where MaKhachHang=" + makh + "";
            return database.ExcuQuery(sql);
        }
        static public void Update(QuyDinhDTO qd)
        {
            string sql = "update QuyDinh set SoLuongNhapToiThieu=(" + qd.SoLuongNhapToiThieu + "),SoLuongTonToiThieu=(" + qd.SoLuongTonToiThieu + "),TienNoToiDa=(" + qd.TienNoToiDa + "),LuongTonToiThieuSauKhiBan=(" + qd.LuongTonToiThieuSauKhiBan + "),DieuKienThu=(" + qd.DieuKienThu+ ")";
            database.ExcuNonQuery(sql);
        }
    }
}
